package com.caterina.components;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.caterina.activityManager.CActivity;

public abstract class CSpringButton extends CActivityButton {
	public CSpringButton(String iconPath,String text,CActivity thisActivity){
		super(text,thisActivity);
		createIcon(iconPath);
		createSourface();
	}
	public boolean isLocked(){
		return isLocked;
	}
	private void createIcon(String pathName){
		this.iconPanel=new JPanel();
		iconPanel.setOpaque(false);
		ImageIcon icn=new ImageIcon(pathName);
		icn=new ImageIcon(icn.getImage().getScaledInstance(80, 80, Image.SCALE_SMOOTH));
		icon=new JLabel();
		icon.setIcon(icn);
		icon.setAlignmentX(CENTER_ALIGNMENT);
		iconPanel.add(icon);
	}
	public Icon getIcon(){
		return icon.getIcon();
	}
	private void createSourface(){
		this.setPreferredSize(new Dimension(130,120));
		this.setMaximumSize(new Dimension(130,120));
		this.add(iconPanel,BorderLayout.CENTER);
		this.add(new JLabel(" "),BorderLayout.EAST);
		this.add(new JLabel(" "),BorderLayout.WEST);
	}
	private JPanel iconPanel;
	private JLabel icon;
	private boolean isLocked=true;
	private static final long serialVersionUID = 1L;
}
